<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>获取属性</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<script  src="../../js/jquery-3.2.1.min.js"></script>
	
	
	<style type="text/css">
		 	div,span{
			    width: 140px;
			    height: 140px;
			    margin: 20px;
			    background: #9999CC;
			    border: #000 1px solid;
				float:left;
			    font-size: 17px;
			    font-family:Roman;
			}
			
			div.mini{
			    width: 30px;
			    height: 30px;
			    background: #CC66FF;
			    border: #000 1px solid;
			    font-size: 12px;
			    font-family:Roman;
			}
			
			div.visible{
				display:none;
			}
	 </style>
    
	<script type="text/javascript">
	
		
		$(function(){
		 //获取北京节点的name属性值
			var val = $("#bj").attr("name");
			alert(val);
		//设置北京节点的name属性的值为dabeijing
			$("#bj").attr("name","dabeijing");
		//新增北京节点的discription属性 属性值是didu
			$("#bj").attr("discription","didu");
		//删除北京节点的name属性并检验name属性是否存在
		  $("#bj").removeAttr("name");
		//获得hobby的的选中状态
		 alert($("#hobby").c("checked"));
		});
		
	</script>
	
	
	</head>
	 
	<body>
				
		 <ul>
		 	 <li id="bj" name="beijing" xxx="yyy">北京</li>
			 <li id="tj" name="tianjin">天津</li>
		 </ul>
		 <input type="checkbox" id="hobby"/>
		 
		
	</body>
	
	
   
</html>



